package scauCmiScaffolding.compiled;

import org.eclipse.jet.JET2Context;
import org.eclipse.jet.JET2Template;
import org.eclipse.jet.JET2Writer;
import org.eclipse.jet.taglib.RuntimeTagElement;
import org.eclipse.jet.taglib.TagInfo;

public class _jet_cmiProjectService implements JET2Template {
    private static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$
    private static final String _jetns_java = "org.eclipse.jet.javaTags"; //$NON-NLS-1$

    public _jet_cmiProjectService() {
        super();
    }

    private static final String NL = System.getProperty("line.separator"); //$NON-NLS-1$
    
    private static final TagInfo _td_c_get_5_9 = new TagInfo("c:get", //$NON-NLS-1$
            5, 9,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "$packageName", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_12_8 = new TagInfo("c:get", //$NON-NLS-1$
            12, 8,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "$packageName", //$NON-NLS-1$
            } );
    private static final TagInfo _td_java_format_14_1 = new TagInfo("java:format", //$NON-NLS-1$
            14, 1,
            new String[] {
            },
            new String[] {
            } );
    private static final TagInfo _td_c_get_15_18 = new TagInfo("c:get", //$NON-NLS-1$
            15, 18,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "uppercaseFirst($projectName)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_16_18 = new TagInfo("c:get", //$NON-NLS-1$
            16, 18,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "uppercaseFirst($projectName)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_17_35 = new TagInfo("c:get", //$NON-NLS-1$
            17, 35,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "$projectName", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_iterate_21_3 = new TagInfo("c:iterate", //$NON-NLS-1$
            21, 3,
            new String[] {
                "var", //$NON-NLS-1$
                "select", //$NON-NLS-1$
            },
            new String[] {
                "eachTable", //$NON-NLS-1$
                "$table", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_if_22_4 = new TagInfo("c:if", //$NON-NLS-1$
            22, 4,
            new String[] {
                "test", //$NON-NLS-1$
            },
            new String[] {
                "$eachTable/@isRelation='false'", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_24_15 = new TagInfo("c:get", //$NON-NLS-1$
            24, 15,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "uppercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_24_69 = new TagInfo("c:get", //$NON-NLS-1$
            24, 69,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "lowercaseFirst($eachTable/@name)", //$NON-NLS-1$
            } );

    public void generate(final JET2Context context, final JET2Writer __out) {
        JET2Writer out = __out;
        out.write("/**");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(" * 封装所有的实体类的DAO对象，项目特定的注入在父类CmiService中注入。");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(" * ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(" * */");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("package ");  //$NON-NLS-1$        
        RuntimeTagElement _jettag_c_get_5_9 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_5_9); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_c_get_5_9.setRuntimeParent(null);
        _jettag_c_get_5_9.setTagInfo(_td_c_get_5_9);
        _jettag_c_get_5_9.doStart(context, out);
        _jettag_c_get_5_9.doEnd();
        out.write(".base;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("import javax.persistence.EntityManager;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import javax.persistence.PersistenceContext;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("import org.springframework.beans.factory.annotation.Autowired;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import org.springframework.stereotype.Controller;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import ");  //$NON-NLS-1$        
        RuntimeTagElement _jettag_c_get_12_8 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_12_8); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_c_get_12_8.setRuntimeParent(null);
        _jettag_c_get_12_8.setTagInfo(_td_c_get_12_8);
        _jettag_c_get_12_8.doStart(context, out);
        _jettag_c_get_12_8.doEnd();
        out.write(".dao.*;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        RuntimeTagElement _jettag_java_format_14_1 = context.getTagFactory().createRuntimeTag(_jetns_java, "format", "java:format", _td_java_format_14_1); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_java_format_14_1.setRuntimeParent(null);
        _jettag_java_format_14_1.setTagInfo(_td_java_format_14_1);
        _jettag_java_format_14_1.doStart(context, out);
        JET2Writer _jettag_java_format_14_1_saved_out = out;
        while (_jettag_java_format_14_1.okToProcessBody()) {
            out = out.newNestedContentWriter();
            out.write(NL);         
            out.write("\t@Controller(\"Cmi");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_get_15_18 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_15_18); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_get_15_18.setRuntimeParent(_jettag_java_format_14_1);
            _jettag_c_get_15_18.setTagInfo(_td_c_get_15_18);
            _jettag_c_get_15_18.doStart(context, out);
            _jettag_c_get_15_18.doEnd();
            out.write("Service\")");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic class Cmi");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_get_16_18 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_16_18); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_get_16_18.setRuntimeParent(_jettag_java_format_14_1);
            _jettag_c_get_16_18.setTagInfo(_td_c_get_16_18);
            _jettag_c_get_16_18.doStart(context, out);
            _jettag_c_get_16_18.doEnd();
            out.write("Service extends CmiService{");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t@PersistenceContext(unitName = \"");  //$NON-NLS-1$        
            RuntimeTagElement _jettag_c_get_17_35 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_17_35); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_get_17_35.setRuntimeParent(_jettag_java_format_14_1);
            _jettag_c_get_17_35.setTagInfo(_td_c_get_17_35);
            _jettag_c_get_17_35.doStart(context, out);
            _jettag_c_get_17_35.doEnd();
            out.write("\")");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tprotected EntityManager entityManager;");  //$NON-NLS-1$        
            out.write(NL);         
            //纯联系表不需要封装，没有纯联系表相关的实体类、DAO类等 ，所有的列是外键列的表就是纯联系表
            //自动包装DAO对象 
            RuntimeTagElement _jettag_c_iterate_21_3 = context.getTagFactory().createRuntimeTag(_jetns_c, "iterate", "c:iterate", _td_c_iterate_21_3); //$NON-NLS-1$ //$NON-NLS-2$
            _jettag_c_iterate_21_3.setRuntimeParent(_jettag_java_format_14_1);
            _jettag_c_iterate_21_3.setTagInfo(_td_c_iterate_21_3);
            _jettag_c_iterate_21_3.doStart(context, out);
            while (_jettag_c_iterate_21_3.okToProcessBody()) {
                RuntimeTagElement _jettag_c_if_22_4 = context.getTagFactory().createRuntimeTag(_jetns_c, "if", "c:if", _td_c_if_22_4); //$NON-NLS-1$ //$NON-NLS-2$
                _jettag_c_if_22_4.setRuntimeParent(_jettag_c_iterate_21_3);
                _jettag_c_if_22_4.setTagInfo(_td_c_if_22_4);
                _jettag_c_if_22_4.doStart(context, out);
                while (_jettag_c_if_22_4.okToProcessBody()) {
                    out.write("\t\t\t\t@Autowired\t\t");  //$NON-NLS-1$        
                    out.write(NL);         
                    out.write("\t\t\t\tprotected ");  //$NON-NLS-1$        
                    RuntimeTagElement _jettag_c_get_24_15 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_24_15); //$NON-NLS-1$ //$NON-NLS-2$
                    _jettag_c_get_24_15.setRuntimeParent(_jettag_c_if_22_4);
                    _jettag_c_get_24_15.setTagInfo(_td_c_get_24_15);
                    _jettag_c_get_24_15.doStart(context, out);
                    _jettag_c_get_24_15.doEnd();
                    out.write("DAO ");  //$NON-NLS-1$        
                    RuntimeTagElement _jettag_c_get_24_69 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_24_69); //$NON-NLS-1$ //$NON-NLS-2$
                    _jettag_c_get_24_69.setRuntimeParent(_jettag_c_if_22_4);
                    _jettag_c_get_24_69.setTagInfo(_td_c_get_24_69);
                    _jettag_c_get_24_69.doStart(context, out);
                    _jettag_c_get_24_69.doEnd();
                    out.write("DAO;");  //$NON-NLS-1$        
                    out.write(NL);         
                    _jettag_c_if_22_4.handleBodyContent(out);
                }
                _jettag_c_if_22_4.doEnd();
                _jettag_c_iterate_21_3.handleBodyContent(out);
            }
            _jettag_c_iterate_21_3.doEnd();
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            _jettag_java_format_14_1.handleBodyContent(out);
        }
        out = _jettag_java_format_14_1_saved_out;
        _jettag_java_format_14_1.doEnd();
    }
}
